package com.sun.stringescapeutils;

import org.apache.commons.lang3.StringEscapeUtils;

import javax.annotation.Resource;

@Resource
public class HtmlTest1 {
    public static void main(String[] args) {
        String s = html4To("<a>abc</a>");
        String s1 = html3To("<a>abc</a>");
        System.out.println(s);
        System.out.println(s1);
        String s2 = toHtml4(s);
        System.out.println(s2);
    }


    public static String html4To(String html){
        //escapeHtml转义html脚本
        return StringEscapeUtils.escapeHtml4(html);
    }

    public static String toHtml4(String str){
        return StringEscapeUtils.unescapeHtml4(str);
    }

    public static String html3To(String html){
        //escapeHtml转义html脚本
        return StringEscapeUtils.escapeHtml3(html);
    }

    public static String toHtml3(String str){
        return StringEscapeUtils.unescapeHtml3(str);
    }

}
